package com.eorchis.module.classuser.service.impl;

import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Blob;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.eorchis.components.attachment.ui.commond.AttachmentCommond;
import com.eorchis.constants.RoleConstants;
import com.eorchis.core.basedao.dao.IDaoSupport;
import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.service.impl.AbstractBaseService;
import com.eorchis.core.springext.mvc.SessionConstant;
import com.eorchis.log.LogRecord;
import com.eorchis.log.LogRecordParam;
import com.eorchis.log.LogThread;
import com.eorchis.module.TrainingConstants;
import com.eorchis.module.basedata.domain.BaseData;
import com.eorchis.module.basedata.domain.BaseDataCondition;
import com.eorchis.module.basedata.manager.IBaseDataManager;
import com.eorchis.module.basedata.service.cache.BaseDataCacheUtil;
import com.eorchis.module.classplanapply.service.IClassPlanApplyService;
import com.eorchis.module.classplanapply.ui.commond.ClassPlanApplyQueryCommond;
import com.eorchis.module.classplanapply.ui.commond.ClassPlanApplyValidCommond;
import com.eorchis.module.classuser.dao.IClassUserDao;
import com.eorchis.module.classuser.domain.ClassUser;
import com.eorchis.module.classuser.domain.ClassUserCommond;
import com.eorchis.module.classuser.domain.QueryClassUserBean;
import com.eorchis.module.classuser.domain.QueryTrainingHoursBean;
import com.eorchis.module.classuser.domain.RecordInfo;
import com.eorchis.module.classuser.domain.RecordInfoBean;
import com.eorchis.module.classuser.domain.UserClassTypeHour;
import com.eorchis.module.classuser.service.IClassUserService;
import com.eorchis.module.classuser.ui.commond.ClassUserQueryCommond;
import com.eorchis.module.classuser.ui.commond.ClassUserValidCommond;
import com.eorchis.module.department.dao.IDepartmentUserDao;
import com.eorchis.module.department.domain.Department;
import com.eorchis.module.department.domain.DepartmentUser;
import com.eorchis.module.department.domain.DepartmentUserCondition;
import com.eorchis.module.exceluitls.domain.excel.ExcelCell;
import com.eorchis.module.remind.domain.Remind;
import com.eorchis.module.remind.service.IRemindService;
import com.eorchis.module.security.cas.domain.Role;
import com.eorchis.module.trainingclass.domain.TrainingClass;
import com.eorchis.module.trainingclass.domain.TrainingClassQueryBean;
import com.eorchis.module.trainingclass.service.ITrainingClassService;
import com.eorchis.module.trainingclass.ui.commond.TrainingClassQueryCommond;
import com.eorchis.module.trainingclass.ui.commond.TrainingClassValidCommond;
import com.eorchis.module.trainingquestionnaire.dao.IUserAnswerLinkDao;
import com.eorchis.module.user.domain.User;
import com.eorchis.module.util.Base64Util;
import com.eorchis.util.UniteConstants;
import com.eorchis.utils.DateUtil;
import com.eorchis.utils.utils.PropertyUtil;

/**
 * Title: ClassUserServiceImpl<br>
 * Description: 培训班用户关系管理业务接口实现<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * 
 * @createDate 2013-12-10
 * @version $Revision$
 */
// 声明本类为Server实现类，声明bean名称
@Service(value = "com.eorchis.module.classuser.service.impl.ClassUserServiceImpl")
public class ClassUserServiceImpl extends AbstractBaseService implements IClassUserService {

	@Resource(name = "com.eorchis.module.classuser.dao.impl.ClassUserDaoImpl")
	private IClassUserDao classUserDao;

	// 培训班信息接口
	@Autowired
	@Qualifier("com.eorchis.module.trainingclass.service.impl.TrainingClassServiceImpl")
	private ITrainingClassService trainingClassService;

	//数据字典缓存
	@Resource(name = "com.eorchis.module.basedata.service.cache.BaseDataCacheUtil")
	private BaseDataCacheUtil baseDataCacheUtil;
	
	// 提醒表接口
	@Resource(name = "com.eorchis.module.remind.service.impl.RemindServiceImpl")
	private IRemindService remindService;

	// 班级计划报名接口
	@Autowired
	@Qualifier("com.eorchis.module.classplanapply.service.impl.ClassPlanApplyServiceImpl")
	private IClassPlanApplyService classPlanApplyService;
	// 部门用户信息接口
	@Autowired
	@Qualifier("com.eorchis.module.department.dao.impl.DepartmentUserDaoImpl")
	private IDepartmentUserDao departmentUserDao;

	@Autowired
	@Qualifier("com.eorchis.module.trainingquestionnaire.dao.impl.UserAnswerLinkDaoImpl")
	private IUserAnswerLinkDao userAnswerLinkDao;

	// 解密 2015/5/5 -GUOL
	@Resource(name = "com.eorchis.module.util.Base64Util")
	private Base64Util base64Util;

	@Override
	public IDaoSupport getDaoSupport() {
		return classUserDao;
	}

	@Autowired
	@Qualifier("com.eorchis.module.basedata.manager.impl.BaseDataManagerImpl")
	private IBaseDataManager baseDataManager;

	@Override
	@SuppressWarnings("unchecked")
	public ClassUserValidCommond toCommond(IBaseEntity entity) {
		return new ClassUserValidCommond((ClassUser) entity);
	}

	/**
	 * 更新用户培训学时
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-11
	 */
	public String updateTrainingHours(ClassUserValidCommond commond) throws Exception {
		Double hours = classUserDao.queryTrainingHours(commond.getClassUserId());
		if (commond.getTrainingHours() > hours) {
			return "超过班级学时：" + hours;
		} else {

			return "更新成功";
		}
	}

	/**
	 * 查询未选人员列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2012-12-10
	 */
	@Override
	public List<QueryClassUserBean> findNoSelectedUserList(ClassUserQueryCommond queryCommond) throws Exception {
		if(!PropertyUtil.objectNotEmpty(queryCommond.getSearchTreePaths())){
			List<Department> department = classUserDao.findDepTreePath(queryCommond);
			String treepath = department.get(0).getTreepath();
			queryCommond.setSearchTreePath(treepath);
		}
		List<QueryClassUserBean> queryClassUserBeans = classUserDao.findNoSelectedUserList(queryCommond);
		return queryClassUserBeans;
	}

	/**
	 * 添加学员
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2013-12-12
	 */
	@Override
	public String batchSave(ClassUserQueryCommond queryCommond) throws Exception {
		Double defaultTrainingHours = this.getDefaultTrainingHours(queryCommond.getSearchClassID());// 学员的默认学时
		String msg = "";
		if (TrainingClass.D_CLASS_TYPE.equals(queryCommond.getSearchClassCategory()) && queryCommond.getEndState() == 1) {// 单位上报区级项目,当结班了需要补报名
																															// 结班：1未结班：2
			String[] s = queryCommond.getSearchUserIds();
			for (int i = 0; i < s.length; i++) {
				ClassUser classUser = new ClassUser();
				User user = new User();
				user.setUserId(s[i]);
				classUser.setUser(user);
				TrainingClass trainingClass = new TrainingClass();
				trainingClass.setClassId(queryCommond.getSearchClassID());
				classUser.setTrainingClass(trainingClass);
				classUser.setTrainingHours(defaultTrainingHours);
				classUserDao.save(classUser);
			}
			msg = "添加成功";

			// 添加成功后更改培训班向干教网同步人员状态为未同步 by HuangTF At 2014-02-28
			String[] classIds = { queryCommond.getSearchClassID() };
			queryCommond.setSearchClassIds(classIds);
			classUserDao.updateGjSyncClassUserState(queryCommond);
			// 更改培训班同步学时状态为未同步
			classUserDao.updateGjSyncTrainingHourState(queryCommond);
		} else {// 所有项目不用补报名的逻辑
				// 判断添加数量是否已经超过班级人数
			String[] s = queryCommond.getSearchUserIds();
			Integer reportedNum = 0;// 已报人数
			Integer classUserNum = 0;// 班级人数
			Integer nowNum = s.length;// 现报人数
			// 获取已报人数和限制人数
			TrainingClassQueryCommond trainingClassQueryCommond = new TrainingClassQueryCommond();
			trainingClassQueryCommond.setSearchClassId(queryCommond.getSearchClassID());
			// List<TrainingClassQueryBean>
			// classList=trainingClassDao.findTrainingClassList(trainingClassQueryCommond);
			List<TrainingClassQueryBean> classList = new ArrayList<TrainingClassQueryBean>();
			reportedNum = classList.get(0).getReportedNumber().intValue();
			classUserNum = classList.get(0).getClassUserNum();
			int num = reportedNum + nowNum - classUserNum;
			if (num > 0) {
				msg = "添加人数已经超过班级人数范围";
			} else {// 添加人员
				for (int i = 0; i < s.length; i++) {
					ClassUser classUser = new ClassUser();
					User user = new User();
					user.setUserId(s[i]);
					classUser.setUser(user);
					TrainingClass trainingClass = new TrainingClass();
					trainingClass.setClassId(queryCommond.getSearchClassID());
					classUser.setTrainingClass(trainingClass);
					classUser.setTrainingHours(defaultTrainingHours);
					if (TrainingClass.D_CLASS_TYPE.equals(queryCommond.getSearchClassCategory())) {// 单位班加入学员后，学员审核状态为未审核
						classUser.setAuditingState(ClassUser.NO_AUDITING);
						// 班级已上报再添加人员这时班级的上报状态需要变成未上报 未上报状态:2 已上报状态：1
						if (PropertyUtil.objectNotEmpty(queryCommond.getReportState()) && queryCommond.getReportState() == 1) {
							classUserDao.updateReportState(queryCommond);
						}
					} else {// 区级点名调训班加入学员后，学员审核状态为审核通过
					}
					classUserDao.save(classUser);
				}
				msg = "添加成功";

				// 添加成功后更改培训班向干教网同步人员状态为未同步 by HuangTF At 2014-02-28
				String[] classIds = { queryCommond.getSearchClassID() };
				queryCommond.setSearchClassIds(classIds);
				classUserDao.updateGjSyncClassUserState(queryCommond);
				// 更改培训班同步学时状态为未同步
				classUserDao.updateGjSyncTrainingHourState(queryCommond);
			}
		}
		return msg;
	}

	/**
	 * 添加学员(区级项目报名)
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2013-12-25
	 */
	@Override
	public String batchSaveUser(ClassUserQueryCommond queryCommond) throws Exception {
		Double defaultTrainingHours = this.getDefaultTrainingHours(queryCommond.getSearchClassID());// 学员的默认学时
		String msg = "";
		String[] s = queryCommond.getSearchUserIds();
		if (TrainingConstants.ZDBMJG.equals(queryCommond.getSearchApplyOrganCode())) {// 指定报名机构的培训班
			// 判断添加数量是否已经超过限报人数
			Integer reportedNum = 0;// 已报人数
			Integer restrictPersonNum = 0;// 限制人数
			Integer nowNum = s.length;// 现报人数
			// 获取已报人数和限制人数
			TrainingClassQueryCommond trainingClassQueryCommond = new TrainingClassQueryCommond();
			trainingClassQueryCommond.setSearchDepId(queryCommond.getSearchDepId());
			// queryCommond.setSearchDepId("1822175");
			trainingClassQueryCommond.setSearchClassCategory(TrainingClass.Q_CLASS_TYPE);// 只查区级班
			trainingClassQueryCommond.setSearchActiveState(TrainingConstants.IS_ACTIVE_Y);// 启用状态
			trainingClassQueryCommond.setSearchDataCode(TrainingConstants.BZDBMJG);// 不指定报名机构
			trainingClassQueryCommond.setSearchClassId(queryCommond.getSearchClassID());
			// List<TrainingClassQueryBean>
			// classList=trainingClassDao.findOrganizationTrainingClassList(trainingClassQueryCommond);
			List<TrainingClassQueryBean> classList = new ArrayList<TrainingClassQueryBean>();
			reportedNum = classList.get(0).getReportedNumber().intValue();
			restrictPersonNum = classList.get(0).getRestrictPersonNum().intValue();
			if (nowNum + reportedNum > restrictPersonNum) {
				msg = "添加人数已经超过班级人数范围";
			} else {// 添加人员
				for (int i = 0; i < s.length; i++) {
					ClassUser classUser = new ClassUser();
					User user = new User();
					user.setUserId(s[i]);
					classUser.setUser(user);
					TrainingClass trainingClass = new TrainingClass();
					trainingClass.setClassId(queryCommond.getSearchClassID());
					classUser.setTrainingClass(trainingClass);
					classUser.setTrainingHours(defaultTrainingHours);
					classUser.setLatestOperateDate(new Date()); // 更新最后操作时间

					classUserDao.save(classUser);
				}
				msg = "添加成功";

				// 添加成功后更改培训班向干教网同步人员状态为未同步 by HuangTF At 2014-02-28
				String[] classIds = { queryCommond.getSearchClassID() };
				queryCommond.setSearchClassIds(classIds);
				classUserDao.updateGjSyncClassUserState(queryCommond);
				// 更改培训班同步学时状态为未同步
				classUserDao.updateGjSyncTrainingHourState(queryCommond);
			}
		}
		if (TrainingConstants.BZDBMJG.equals(queryCommond.getSearchApplyOrganCode())) {// 不指定报名机构的培训班
			for (int i = 0; i < s.length; i++) {
				ClassUser classUser = new ClassUser();
				User user = new User();
				user.setUserId(s[i]);
				classUser.setUser(user);
				TrainingClass trainingClass = new TrainingClass();
				trainingClass.setClassId(queryCommond.getSearchClassID());
				classUser.setTrainingClass(trainingClass);
				classUser.setTrainingHours(defaultTrainingHours);
				classUser.setLatestOperateDate(new Date()); // 更新最后操作时间
				classUserDao.save(classUser);
			}
			msg = "添加成功";

			// 添加成功后更改培训班向干教网同步人员状态为未同步 by HuangTF At 2014-02-28
			String[] classIds = { queryCommond.getSearchClassID() };
			queryCommond.setSearchClassIds(classIds);
			classUserDao.updateGjSyncClassUserState(queryCommond);
			// 更改培训班同步学时状态为未同步
			classUserDao.updateGjSyncTrainingHourState(queryCommond);
		}
		return msg;
	}

	/**
	 * 添加学员(区级项目补报名)
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2014-1-23
	 */
	@Override
	public String replenishBatchSaveUser(ClassUserQueryCommond queryCommond) throws Exception {
		Double defaultTrainingHours = this.getDefaultTrainingHours(queryCommond.getSearchClassID());// 学员的默认学时
		String msg = "";
		String[] s = queryCommond.getSearchUserIds();
		for (int i = 0; i < s.length; i++) {
			ClassUser classUser = new ClassUser();
			User user = new User();
			user.setUserId(s[i]);
			classUser.setUser(user);
			TrainingClass trainingClass = new TrainingClass();
			trainingClass.setClassId(queryCommond.getSearchClassID());
			classUser.setTrainingClass(trainingClass);
			classUser.setTrainingHours(defaultTrainingHours);
			classUserDao.save(classUser);
		}
		msg = "添加成功";

		// 添加成功后更改培训班向干教网同步人员状态为未同步 by HuangTF At 2014-02-28
		String[] classIds = { queryCommond.getSearchClassID() };
		queryCommond.setSearchClassIds(classIds);
		classUserDao.updateGjSyncClassUserState(queryCommond);
		// 更改培训班同步学时状态为未同步
		classUserDao.updateGjSyncTrainingHourState(queryCommond);
		return msg;
	}

	/**
	 * 结班时统一更新用户培训学时
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-20
	 */
	public void updateTrainingHoursOnEnd(ClassUserValidCommond commond) throws Exception {
		if (PropertyUtil.objectNotEmpty(commond.getTrainingClass())) {
			if (PropertyUtil.objectNotEmpty(commond.getTrainingHours()) && PropertyUtil.objectNotEmpty(commond.getTrainingClass().getClassId())
					&& PropertyUtil.objectNotEmpty(commond.getAuditingState())) {
				classUserDao.updateTrainingHoursOnEnd(commond);
			}
		}
	}

	/**
	 * 获取向培训班添加人员时学员的默认学时
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2014-5-6
	 */
	public Double getDefaultTrainingHours(String classId) throws Exception {
		// 判断当前班级是否已结班，已结班的班级添加人员时人员学时默认为班级学时，未结班的班级人员学时默认为0
		Double trainingHours = 0d;
		TrainingClass tc = this.getDaoSupport().find(TrainingClass.class, classId);
		if (tc.getEndState().intValue() == TrainingClass.IS_ENDSTATE_Y.intValue()) {
			trainingHours = tc.getTrainingHour();
		}
		return trainingHours;
	}

	/**
	 * 填写学时的时候添加人员到培训班
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-23
	 */
	public void addUser(ClassUserQueryCommond queryCommond) throws Exception {
		Double defaultTrainingHours = this.getDefaultTrainingHours(queryCommond.getSearchClassID());// 学员的默认学时
		String[] s = queryCommond.getSearchUserIds();
		int num = this.exceedNum(queryCommond, s.length);// 添加人员后超出班级上限的人数
		if (num > 0) {
			classUserDao.updateClassUserNum(queryCommond.getSearchClassID(), queryCommond.getClassUserNum() + num);
		}
		for (int i = 0; i < s.length; i++) {
			ClassUser classUser = new ClassUser();
			User user = new User();
			user.setUserId(s[i]);
			classUser.setUser(user);
			TrainingClass trainingClass = new TrainingClass();
			trainingClass.setClassId(queryCommond.getSearchClassID());
			classUser.setTrainingClass(trainingClass);
			classUser.setTrainingHours(defaultTrainingHours);
			if (PropertyUtil.objectNotEmpty(queryCommond.getSearchClassCategory())) {
				if (TrainingClass.D_CLASS_TYPE.equals(queryCommond.getSearchClassCategory())) {
					// 单位班加入学员后，学员审核状态为未审核
					classUser.setAuditingState(ClassUser.NO_AUDITING);

				} else if (TrainingClass.DS_CLASS_TYPE.equals(queryCommond.getSearchClassCategory())) {
					// 单位上报市级项目添加学员
					classUser.setAuditingState(ClassUser.IS_AUDITING_Y);
				} else {
					// 区级点名调训班加入学员后，学员审核状态为审核通过
				}
			}
			classUser.setLatestOperateDate(new Date()); // 更新最后操作时间
			classUserDao.save(classUser);
			if (!TrainingClass.D_CLASS_TYPE.equals(queryCommond.getSearchClassCategory())) {
				// 不需审核人员的培训班添加成功后更改培训班向干教网同步人员状态为未同步 by HuangTF At 2014-02-28
				String[] classIds = { queryCommond.getSearchClassID() };
				queryCommond.setSearchClassIds(classIds);
				classUserDao.updateGjSyncClassUserState(queryCommond);
				// 更改培训班同步学时状态为未同步
				classUserDao.updateGjSyncTrainingHourState(queryCommond);
			}
		}
	}

	/**
	 * 判断添加人数是否超过培训班人数
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-23
	 */
	public int exceedNum(ClassUserQueryCommond queryCommond, int nowNum) throws Exception {
		Integer reportedNum = 0;// 已报人数
		Integer classUserNum = 0;// 班级人数上限
		// 获取已报人数
		TrainingClassQueryCommond trainingClassQueryCommond = new TrainingClassQueryCommond();
		trainingClassQueryCommond.setSearchClassId(queryCommond.getSearchClassID());
		// List<TrainingClassQueryBean>
		// classList=trainingClassDao.findTrainingClassList(trainingClassQueryCommond);
		List<TrainingClassQueryBean> classList = new ArrayList<TrainingClassQueryBean>();
		reportedNum = classList.get(0).getReportedNum().intValue();
		classUserNum = classList.get(0).getClassUserNum();
		// add by dhc @2014-04-14 防止已报人数及班级人数上限出现值为null现象导致报错
		if (!PropertyUtil.objectNotEmpty(reportedNum)) {
			reportedNum = 0;
		}
		if (!PropertyUtil.objectNotEmpty(classUserNum)) {
			classUserNum = 0;
		}
		return reportedNum + nowNum - classUserNum;
	}

	/**
	 * 再次报名
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2013-12-23
	 */
	public void updateAuditingState(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateAuditingState(queryCommond);
	}

	/**
	 * 单位上报学时
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-23
	 */
	public void updateReportedHoursState(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateReportedHoursState(queryCommond);
	}

	/**
	 * 处理发放给单位填写学时
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-25
	 */
	public void updateWriteHoursRank(ClassUserQueryCommond queryCommond) throws Exception {
		this.addUserToDW(queryCommond);// 发放前先添加学员到培训班

		classUserDao.updateWriteHoursRank(queryCommond);
	}

	/**
	 * 发放给单位填写学时页面待添加学员列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2014-1-6
	 */
	public List<QueryClassUserBean> findListUserToDW(ClassUserQueryCommond queryCommond) throws Exception {
		if (PropertyUtil.objectNotEmpty(queryCommond.getSearchDepId())) {
			queryCommond.setSearchTreePath(classUserDao.findDepTreePath(queryCommond).get(0).getTreepath());
		}

		return classUserDao.findListUserToDW(queryCommond);
	}

	/**
	 * 发放给单位填写学时添加人员到培训班
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-23
	 */
	public void addUserToDW(ClassUserQueryCommond queryCommond) throws Exception {
		Double defaultTrainingHours = this.getDefaultTrainingHours(queryCommond.getSearchClassID());// 学员的默认学时
		String[] userIds = queryCommond.getSearchUserIds();
		String classId = queryCommond.getSearchClassID();
		int sign = 0;
		for (String userId : userIds) {
			if (!classUserDao.isOnClass(classId, userId)) {
				sign++;

				ClassUser classUser = new ClassUser();
				User user = new User();
				user.setUserId(userId);
				classUser.setUser(user);
				TrainingClass trainingClass = new TrainingClass();
				trainingClass.setClassId(queryCommond.getSearchClassID());
				classUser.setTrainingClass(trainingClass);
				classUser.setTrainingHours(defaultTrainingHours);
				classUserDao.save(classUser);

				// 添加成功后更改培训班向干教网同步人员状态为未同步 by HuangTF At 2014-02-28
				String[] classIds = { queryCommond.getSearchClassID() };
				queryCommond.setSearchClassIds(classIds);
				classUserDao.updateGjSyncClassUserState(queryCommond);
				// 更改培训班同步学时状态为未同步
				classUserDao.updateGjSyncTrainingHourState(queryCommond);
			}
		}
		int num = this.exceedNum(queryCommond, sign);// 添加人员后超出班级上限的人数
		if (num > 0) {
			classUserDao.updateClassUserNum(queryCommond.getSearchClassID(), queryCommond.getClassUserNum() + num);
		}
	}

	/**
	 * 单位填报市级项目查询班级列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-26
	 */
	public List<TrainingClassQueryBean> findTrainingClassList(TrainingClassQueryCommond queryCommond) throws Exception {
		// 只查询已结班
		queryCommond.setSearchEndState(TrainingClass.IS_ENDSTATE_Y);
		// 只查询市级班
		queryCommond.setSearchClassCategory(TrainingClass.S_CLASS_TYPE);

		List<TrainingClassQueryBean> findList = classUserDao.findTrainingClassList(queryCommond);

		return findList;
	}

	/**
	 * 单位填报市级项目查询人员信息
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2013-12-30
	 */
	public List<QueryClassUserBean> findUserFillIn(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findUserFillIn(queryCommond);
	}

	/**
	 * 批量审核人员
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author Ningss
	 * @createDate 2013-12-30
	 */
	@Override
	public void batchAuditing(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.batchAuditing(queryCommond);
	}

	/**
	 * 统计--干部培训档案查询,查询人员信息以及任职前后学时
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @date 2014-04-01
	 */
	@Override
	public List<QueryClassUserBean> findUserInfoHoursStudyRecordList(ClassUserQueryCommond queryCommond) throws Exception {
		if (PropertyUtil.objectNotEmpty(queryCommond.getSearchDepId())) {
			queryCommond.setSearchTreePath(classUserDao.findDepTreePath(queryCommond).get(0).getTreepath());
		}
		if (PropertyUtil.objectNotEmpty(queryCommond.getEndDateStatistics())) {
			Calendar calendar = Calendar.getInstance();
			calendar.setTime(DateUtil.getDateByString(queryCommond.getEndDateStatistics(), "yyyy-MM"));
			calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DATE));
			queryCommond.setEndDateStatistics(DateUtil.getDateString(calendar.getTime(), "yyyy-MM-dd"));
		}
		return classUserDao.newFindUserInfoHoursStudyRecordList(queryCommond);
	}

	/**
	 * 查询某年度学习档案
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @date 2014-03-26
	 */
	@Override
	public RecordInfo findStudyRecordByYear(ClassUserQueryCommond queryCommond) throws Exception {
		// 查询培训班的培训信息
		List<RecordInfoBean> list = classUserDao.findStudyRecordList(queryCommond);

		Double allHour = 0.0;
		for (RecordInfoBean bean : list) {
			allHour = allHour + bean.getHours();
		}
		RecordInfo ri = new RecordInfo();
		ri.setTrainInfo(list);
		ri.setMergerNum(list.size() + "");
		ri.setAnnualTrainHours(allHour.toString());
		ri.setYear(Integer.valueOf(queryCommond.getTrainingClassYear()));

		return ri;
	}

	/**
	 * 更新班级上报状态
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2014-1-17
	 */
	@Override
	public void updateReportState(ClassUserQueryCommond queryCommond) throws Exception {
		if (PropertyUtil.objectNotEmpty(queryCommond.getReportState()) && queryCommond.getReportState() == 1) {
			QueryTrainingHoursBean bean = classUserDao.queryClassId(queryCommond.getSearchClassUserId());
			queryCommond.setSearchClassID(bean.getClassId());
			classUserDao.updateReportState(queryCommond);
		}
	}

	/**
	 * 更新干教同步学时状态
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2014-2-25
	 */
	@Override
	public void updateGjSyncHoursState(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateGjSyncHoursState(queryCommond);
	}

	/**
	 * 更新培训班表向干教网同步人员同步状态
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2014-2-27
	 */
	public void updateGjSyncClassUserState(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateGjSyncClassUserState(queryCommond);
	}

	/**
	 * 查询当前单位所有人员，包括在当前单位任职的人员
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author HuangTF
	 * @createDate 2014-06-11
	 */
	@Override
	public List<QueryClassUserBean> findAllUserListByDepId(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findAllUserListByDepId(queryCommond);
	}

	@Override
	public List<RecordInfo> findUserStudyRecordList(ClassUserQueryCommond queryCommond) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * 培训班学员报名情况列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2015-1-4
	 */
	@Override
	public List<QueryClassUserBean> getSelectedUserListAttedence(ClassUserQueryCommond queryCommond) throws Exception {
		return this.getList(classUserDao.getSelectedUserListAttedence(queryCommond));
	}

	/**
	 * 根据班级id查询呢考勤情况
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2015-1-4
	 */
	@Override
	public List<QueryClassUserBean> getSelectedUserList(ClassUserQueryCommond queryCommond) throws Exception {
		return this.getList(classUserDao.getSelectedUserList(queryCommond));
	}

	@Override
	public int deleteSelectedUser(ClassUserQueryCommond queryCommond) throws Exception {
		int result = classUserDao.deleteSelectedUser(queryCommond);
		String userIds = "";
		for (int i = 0; i < queryCommond.getSearchUserIds().length; i++) {
			userIds += ", " + queryCommond.getSearchUserIds()[i];
		}
		LogRecordParam param = new LogRecordParam();
		LogRecord logRecord = new LogRecord();
		param.setOpdataId("");// 操作主数据id
		param.setOpbefoData("班级ID=====>" + queryCommond.getSearchClassID().toString() + "\n学员ID=====>" + userIds.substring(2));// 操作后数据
		param.setOpmodule("工委报名调整 - 撤销报名 / 单位报名 - 撤销报名");
		param.setOpcontent("撤销报名");
		param.setOptype(UniteConstants.DELETE);
		logRecord.bulifLogParams(param);
		try {
			LogThread logThread = new LogThread(param);
			Thread thread = new Thread(logThread);
			thread.start();
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return result;
	}

	@Override
	public List<QueryClassUserBean> getSelectedDepartmentList(ClassUserQueryCommond queryCommond) throws Exception {
		queryCommond.setSearchTreePath("-1/1/7380/");
		return classUserDao.getSelectedDepartmentList(queryCommond);
	}

	@Override
	public List<QueryClassUserBean> getSelectedDepartmentUserList(ClassUserQueryCommond queryCommond) throws Exception {
		return this.getList(classUserDao.getSelectedDepartmentUserList(queryCommond));
	}

	/**
	 * 查看考勤情况
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author ShenPS
	 * @date 2015年1月11日
	 */
	@Override
	public List<QueryClassUserBean> getClassAttendancerList(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.getClassAttendancerList(queryCommond);
	}

	/**
	 * 批量更新考勤情况
	 * 
	 * @param queryCommond
	 * @throws Exception
	 * @author ShenPS
	 * @date 2015年1月11日
	 */
	public void updateAttendanceState(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateAttendanceState(queryCommond);
	}

	/**
	 * 批量更新考勤情况
	 * 
	 * @param queryCommond
	 * @throws Exception
	 * @author ShenPS
	 * @date 2015年1月11日
	 */
	public void updateAttendanceStateByClassId(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateAttendanceStateByClassId(queryCommond);
	}

	/**
	 * 批量更新考勤情况
	 * 
	 * @param queryCommond
	 * @throws Exception
	 * @author ShenPS
	 * @date 2015年1月11日
	 */
	public void updateAttendanceStateByClassIdAll(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateAttendanceStateByClassIdAll(queryCommond);
	}

	/**
	 * 人员报名待选列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author ShenPS
	 * @date 2015年1月23日
	 */
	@Override
	public List<QueryClassUserBean> getToChooseUserList(ClassUserQueryCommond queryCommond) throws Exception {
		// queryCommond=this.getQueryCommond(queryCommond);
		// if(PropertyUtil.objectNotEmpty(queryCommond.getSearchDepId())){
		// List<Department>
		// department=classUserDao.findDepTreePath(queryCommond);
		// String treepath=department.get(0).getTreepath();
		// queryCommond.setSearchTreePath(treepath);
		// }
		queryCommond.setSearchTreePath("-1/1/7380/");
		queryCommond.setSearchNotDepId("7380");
		// 获取32个固定单位中不在classID这个班中的人员列表
		return classUserDao.findNoSelectedUserList(queryCommond);
	}

	/**
	 * 班级人员列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author ShenPS
	 * @date 2015年1月27日
	 */
	@Override
	public List<QueryClassUserBean> findTrainingClassUserListNoPage(TrainingClassQueryCommond queryCommond) throws Exception {
		// TODO Auto-generated method stub
		return this.getList(classUserDao.findTrainingClassUserListNoPage(queryCommond));
	}

	/**
	 * 按考勤状态查询班级人员列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @createDate 2015-3-26
	 */
	public List<QueryClassUserBean> findClassUserListByAttendanceState(ClassUserQueryCommond queryCommond) throws Exception {
		// queryCommond=this.getQueryCommond(queryCommond);
		return classUserDao.findClassUserListByAttendanceState(queryCommond);
	}

	/**
	 * 查询未报名人员
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2016-12-23
	 */
	public List<QueryClassUserBean> findClassUserListNoSignUp(ClassUserQueryCommond queryCommond) throws Exception {
		// queryCommond=this.getQueryCommond(queryCommond);
		return classUserDao.findClassUserListNoSignUp(queryCommond);
	}
	/**
	 * 查询班级考核人员
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2017-02-22
	 */
	public List<QueryClassUserBean> findClassUserListExaminationList(ClassUserQueryCommond queryCommond) throws Exception {
		// queryCommond=this.getQueryCommond(queryCommond);
		return classUserDao.findClassUserListExaminationList(queryCommond);
	}

	/**
	 * 解密方法4
	 * 
	 * @param list
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author GuoL
	 * @date 2015-5-5
	 */
	public List<QueryClassUserBean> getList(List<QueryClassUserBean> list) throws Exception {
		int i = 0;
		for (; i < list.size(); i++) {
			if (list.get(i).getUserName() != null && list.get(i).getUserName() != "") {
				byte[] byteArray = Base64Util.decryptBASE64(list.get(i).getUserName());
				String name = new String(byteArray, "utf-8");
				list.get(i).setUserName(name);
			}
		}
		return list;
	}

	/**
	 * 加密方法
	 * 
	 * @param list
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author GuoL
	 * @date 2015-5-5
	 */
	@SuppressWarnings("static-access")
	public ClassUserQueryCommond getQueryCommond(ClassUserQueryCommond queryCommond) throws Exception {
		if (queryCommond.getSearchUserName() != null && queryCommond.getSearchUserName() != "") {
			String name = new String(base64Util.encryptBASE64(queryCommond.getSearchUserName()));
			queryCommond.setSearchUserName(name);
			System.out.println(name);
		}
		return queryCommond;
	}

	@SuppressWarnings({ "deprecation", "static-access" })
	@Override
	public String batchSaveClassUser(ClassUserQueryCommond queryCommond) throws Exception {
		String msg = "";
		ClassUser classUser = new ClassUser();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
		TrainingClass trainingClass = new TrainingClass();
		trainingClass.setClassId(queryCommond.getSearchClassID());
		classUser.setTrainingClass(trainingClass);
		User us;
		QueryClassUserBean us2 = null;
		boolean isAdd=false;//是否是本系统新增人员
		if(PropertyUtil.objectNotEmpty(queryCommond.getSearchUserID())){
			// 新增用户信息
			us = new User();
			us.setUserId(queryCommond.getSearchUserID());
			us.setLoginID(queryCommond.getSearchLoginID());
			us2=classUserDao.getUserbyUnified(us.getUserId());
		}else{
			us = classUserDao.findUserLoginIdUserId(queryCommond);
			isAdd=true;
		}
//		if (PropertyUtil.objectNotEmpty(us)) {
//			us.setUserName(queryCommond.getUserName());
//			if (PropertyUtil.objectNotEmpty(queryCommond.getBirthdayYear()) && PropertyUtil.objectNotEmpty(queryCommond.getBirthdayMouth())) {
//				us.setBirthday(sdf.parse(queryCommond.getBirthdayYear() + "-" + queryCommond.getBirthdayMouth()));
//			}
//			us.setDutyRemark(queryCommond.getDutyRemark());
//			us.setRemark(queryCommond.getRemark());
//			us.setMobileTelephone(queryCommond.getMobileTelephone());
//			us.setActiveState(User.IS_ACTIVE_Y);
//			us.setSexCode(baseDataService.getBaseDataByID(queryCommond.getSexCode()));
//			us.setFolkCode(baseDataService.getBaseDataByID(queryCommond.getFolkCode()));
//			if (PropertyUtil.objectNotEmpty(queryCommond.getAdministrativeLevel()))
//				us.setAdministrativeLevel(baseDataService.getBaseDataByID(queryCommond.getAdministrativeLevel()));
//			classUserDao.update(us);
//		} else {
			us.setUserName(queryCommond.getUserName());
			if (PropertyUtil.objectNotEmpty(queryCommond.getBirthday()))
				us.setBirthday(sdf.parse(queryCommond.getBirthday()));
			else
				us.setBirthday(sdf.parse(queryCommond.getBirthdayYear()+"-"+queryCommond.getBirthdayMouth()));
			us.setDutyRemark(queryCommond.getDutyRemark());
			us.setRemark(queryCommond.getRemark());
			us.setMobileTelephone(queryCommond.getMobileTelephone());
			us.setActiveState(User.IS_ACTIVE_Y);
			BaseData sex = new BaseData();
			Map<String, BaseData> baseDataMap=baseDataCacheUtil.getBaseData();
			sex.setDataCode(queryCommond.getSexCode());
			sex.setDataName(baseDataMap.get(sex.getDataCode()).getDataName());
			BaseData folk = new BaseData();
			folk.setDataCode(queryCommond.getFolkCode());
			folk.setDataName(baseDataMap.get(folk.getDataCode()).getDataName());
//			BaseData level = new BaseData();
//			level.setDataCode(queryCommond.getAdministrativeLevel());
			BaseData rank = new BaseData();//职级
			rank.setDataCode(queryCommond.getRank());
			rank.setDataName(baseDataMap.get(rank.getDataCode()).getDataName());
//			us.setAdministrativeLevel(level);
			us.setSexCode(sex);
			us.setFolkCode(folk);
			us.setDutyLevelCode(rank);
			
			//扩展 
//			BaseData degree = new BaseData();
//			degree.setDataCode(queryCommond.getDegreeCode());
//			us.setDegreeCode(degree);
//			BaseData paperTypeCode = new BaseData();
//			paperTypeCode.setDataCode(queryCommond.getPaperTypeCode());
//			us.setPaperTypeCode(paperTypeCode);
//			BaseData dutyLevelCode = new BaseData();
//			dutyLevelCode.setDataCode(queryCommond.getDutyLevelCode());
//			us.setDutyLevelCode(dutyLevelCode);
//			BaseData politicesCode = new BaseData();
//			politicesCode.setDataCode(queryCommond.getPoliticesCode());
//			us.setPoliticesCode(politicesCode);
			
			us.setIsDangwu(User.NOT_DANGWU);
			us.setIsTongzhan(User.NOT_TONGZHAN);
			us.setPassword(User.PASSWORD);
			us.setIsZugong(User.NOT_ZUGONG);
			us.setHierarchy(User.HIERARCHY_C);
			us.setExamState(User.NOT_EXAM);
			us.setIsShiguan(User.IS_NOT_SHIGUAN);
			//设置最后操作时间
//			BaseData Degree = new BaseData();
//			Degree.setDataCode(String.valueOf(User.DEGREE_DEFAULT_VALUE));
			Department departmentGUID = classUserDao.find(Department.class, queryCommond.getSearchDepId());
			/* GUOLEI20160602 */
			us.setGuid(departmentGUID.getDeptCode());
			queryCommond.setSearchDeptCode(departmentGUID.getDeptCode());
//			UserValidCommond uv=new UserValidCommond();
//			org.springframework.beans.BeanUtils.copyProperties(us, uv, new String[]{"Date"});
			classUserDao.save(us);
			
			// 新增部门用户关联表
			DepartmentUser dUser = new DepartmentUser();
			Department department = new Department();
			department.setDeptID(queryCommond.getSearchDepId());
			dUser.setDepartment(department);
			dUser.setActiveState(dUser.IS_ACTIVE_Y);
			User user = new User();
			user.setUserId(us.getUserId());
			dUser.setUser(user);
//			dUser.setLevelDepId(departmentGUID.getParentID());
			dUser.setLevelDepId(queryCommond.getSearchDepId());
			departmentUserDao.addDepartmentUser(dUser);
//		}

		classUser.setAppraiseStatus(ClassUserQueryCommond.APPRAISE_STATUS_NO);
		classUser.setUserName(us.getUserName());
		User user1 = new User();
		user1.setUserId(us.getUserId());
		classUser.setLatestOperateDate(new Date());//添加最后操作时间
		classUser.setUser(user1);
		classUser.setCreateDate(new Date());
		classUser.setSexCode(us.getSexCode());
		classUser.setFolkCode(us.getFolkCode());
		classUser.setDutyLevelCode(us.getDutyLevelCode());
		classUser.setBirthday(us.getBirthday());
		classUser.setRemark(queryCommond.getRemark());
		classUser.setDutyRemark(us.getDutyRemark());
		classUser.setMobileTelephone(us.getMobileTelephone());
		classUser.setAuditingState(queryCommond.getAuditingState());
		if(queryCommond.getAuditingState().equals(ClassUser.IS_AUDITING_Y)){
			classUser.setAuditingDate(new Date());
			classUser.setAuditingUserId(queryCommond.getAuditingUserId());
			classUser.setAuditingUserIP(queryCommond.getAuditingUserIP());
		}
		classUserDao.save(classUser);
		
		//向统一用户平台同步用户
		try{
			if(isAdd&&!us.getDutyLevelCode().getDataCode().equals("1380")&&!us.getDutyLevelCode().getDataCode().equals("1381")){
					//添加临时用户
					classUserDao.addTempUser(us,department);
					//添加正式用户
					classUserDao.addUser(us,department);
	//			classUserDao.addUser(us,departmentGUID);
					//记录审计日志
//					classUserDao.auditUserLogAdd(queryCommond.getAuditingUserId(),us.getUserId(),queryCommond.getAuditingUserIP());
			}else{
//				市管不更新，不存在不更新
				if(classUserDao.isShiguanOrJj(us.getUserId())&&!us.getDutyLevelCode().getDataCode().equals("1380")&&!us.getDutyLevelCode().getDataCode().equals("1381")){
					//更新临时用户
					classUserDao.updateTempUser(us);
					//更新正式用户
					classUserDao.updateUser(us);
				}else{
					//局级同步手机号，职务，民族
					classUserDao.updateJJUserByUnified(us);
				}
				//记录审计日志
//				classUserDao.auditUserLogUpdate(us2,queryCommond.getAuditingUserId(),queryCommond.getAuditingUserIP());
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		msg = "添加成功";
		
		/**
		 * 网上专题班添加学员
		 * @Date 2016-12-28
		 * @author RongSL
		 * */
//		try{
//			URL url = new URL(ClassUser.WSZTB_WSDL_USER_URL);
//			ThematicClassStudentWebServiceImplService service=new ThematicClassStudentWebServiceImplService(url);
//			thematicClassStudentWebServiceImpl=service.getThematicClassStudentWebServiceImplPort();
//			ThematicStudentWrapCondition condition=new ThematicStudentWrapCondition();
//			condition.setSearchUserIDs(user.getUserId());
//			condition.setSearchThematicClassID(queryCommond.getSearchClassID());
////			ThematicStudentResultWrapBean tsr=thematicClassStudentWebServiceImpl.addThematicStudent(condition);
////			if(PropertyUtil.objectNotEmpty(tsr)&&!tsr.isSuccess()){
////				System.out.println(tsr.getMessages());
////			}
//		}catch(Exception e){
//			e.printStackTrace();
//		}
		
		String[] classIds = { queryCommond.getSearchClassID() };
		queryCommond.setSearchClassIds(classIds);
		return msg;
	}

	/**
	 * 获取该部门下最大的用户编号
	 * 
	 * @throws Exception
	 * @author YangJC
	 * @createDate 2016-01-15
	 */
	@SuppressWarnings("unused")
	private String getUserNum(ClassUserQueryCommond vCommond) throws Exception {
		Department department = classUserDao.find(Department.class, vCommond.getSearchDepId());
		String result = classUserDao.getUserNum(vCommond);
		String yy = new SimpleDateFormat("yyyy").format(new Date()).substring(2, 4);
		if (result.equals("empty")) {
			return yy + department.getCode().substring(1, 3) + "001";
		} else {
			String num = (Integer.parseInt(result.substring(result.length() - 3, result.length())) + 1) + "";
			if (num.length() == 1) {
				num = "00" + num;
			} else if (num.length() == 2) {
				num = "0" + num;
			}
			String s = department.getCode().substring(1, 3);
			return yy + s + num;
		}
	}

	@SuppressWarnings({ "unchecked", "deprecation" })
	@Override
	public String importClassUser(FileItem file, HttpServletResponse response, HttpServletRequest request) throws Exception {
		// 获取管理范围
		com.eorchis.module.security.cas.domain.Department department = (com.eorchis.module.security.cas.domain.Department) request.getSession().getAttribute(SessionConstant.CURRENT_SCOPE);
		if (!PropertyUtil.objectNotEmpty(department))
			return "管理范围为空！";

		InputStream inputStream;
		POIFSFileSystem fs;
		HSSFWorkbook wb;
		int rowNum = 0;
		StringBuffer resultStr = new StringBuffer("");
		try {
			inputStream = file.getInputStream();
			fs = new POIFSFileSystem(inputStream);
			wb = new HSSFWorkbook(fs);
			HSSFSheet sheet = wb.getSheetAt(0);
			// Map<String,List<ClassUserValidCommond>> map=new
			// HashMap<String,List<ClassUserValidCommond>>();//key:班级编号
			// valeu:班级人员集合
//			ArrayList<String> list = new ArrayList<String>();
			Set<String> classId = new HashSet<String>();
			Map<String, String> name = new HashMap<String, String>();
			for (Row row : sheet) {
				rowNum = row.getRowNum();
				if (rowNum > 0) {
					ClassUserQueryCommond cuQueryCommond = new ClassUserQueryCommond();
					cuQueryCommond = convertCelltoUser(row, cuQueryCommond);
					if (!PropertyUtil.objectNotEmpty(cuQueryCommond))
						continue;
					String validStr = validateUserInfo(cuQueryCommond, row.getRowNum() + "");

					String classNum = cuQueryCommond.getSearchClassID();
					TrainingClassQueryCommond trainingClassQueryCommond = new TrainingClassQueryCommond();
					trainingClassQueryCommond.setSearchClassNum(classNum);
					Date date = new Date();
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					String time = sdf.format(date);
					trainingClassQueryCommond.setSearchEnterBeginTimeDate(sdf.parse(time));
					trainingClassQueryCommond.setSearchEnterEndTimeDate(sdf.parse(time));
					trainingClassQueryCommond.setSearchActiveState(TrainingClass.IS_ACTIVE_Y);// 活动班级
					trainingClassQueryCommond.setSearchPublishState(TrainingClass.IS_PUBLISH_Y);// 已发布班级
					// trainingClassQueryCommond.setAuditState(TrainingClass.IS_AUDIT_Y);//审核通过班级
					List<TrainingClassValidCommond> trainingClass = (List<TrainingClassValidCommond>) trainingClassService.findAllList(trainingClassQueryCommond);
					if (!(PropertyUtil.objectNotEmpty(trainingClass) && trainingClass.size() > 0)) {// 报名班级不符合报名条件
						validStr += "班级编号为" + classNum + "的班级不存在或者不在报名时间内，请修改后重新导入。\r\n";
						resultStr.append(validStr);
						continue;
					} else {
						TrainingClassValidCommond traClass = trainingClass.get(0);
						if (traClass.getSignUpState() == TrainingClass.IS_SIGNUP_END.intValue() || traClass.getOpenState() == TrainingClass.IS_OPENSTATE_Y.intValue()) {
							validStr += "班级编号为" + classNum + "的班级已结束报名，第" + (rowNum + 1) + "行人员导入失败。\r\n";
							resultStr.append(validStr);
							continue;
						}
						ClassPlanApplyQueryCommond applyCommond = new ClassPlanApplyQueryCommond();
						// queryCommond.setSearchDepId("7449");
						applyCommond.setSearchDeptId(department.getDeptID());
						applyCommond.setSearchClassId(traClass.getClassId());
						List<ClassPlanApplyValidCommond> apply = (List<ClassPlanApplyValidCommond>) classPlanApplyService.findAllList(applyCommond);
						// 查询该部门下培训班的人数
						if (PropertyUtil.objectNotEmpty(apply)) {
							ClassUserQueryCommond quCommond = new ClassUserQueryCommond();
							quCommond.setSearchClassID(traClass.getClassId());
							quCommond.setSearchDepId(department.getDeptID());
							List<ClassUserValidCommond> classUser = (List<ClassUserValidCommond>) this.findAllList(quCommond);
							DepartmentUserCondition condition = new DepartmentUserCondition();
							condition.setSearchDeptIDs(new String[] { department.getDeptID() });
							condition.setSearchUserActiveState(User.IS_ACTIVE_Y);
							if (PropertyUtil.objectNotEmpty(traClass.getSignUpState()) && traClass.getSignUpState() == TrainingClass.IS_SIGNUP_N.intValue()) {
								validStr += "班级编号为" + classNum + "的班级未开始报名，第" + (rowNum + 1) + "行人员导入失败。\r\n";
								resultStr.append(validStr);
								continue;
							} else if (PropertyUtil.objectNotEmpty(traClass.getSignUpState()) && traClass.getSignUpState() == TrainingClass.IS_SIGNUP_END.intValue()) {
								validStr += "班级编号为" + classNum + "的班级已结束报名，第" + (rowNum + 1) + "行人员导入失败。\r\n";
								resultStr.append(validStr);
								continue;
							}
							if (apply.get(0).getAsignCount() > (classUser.size())) {
								/*
								 * String level =
								 * cuQueryCommond.getAdministrativeLevel();
								 * ClassPlanApplyValidCommond count = new
								 * ClassPlanApplyValidCommond(); count =
								 * classPlanApplyService
								 * .findClassAsignCount(applyCommond); if
								 * (level.equals(ClassPlanApply.LEVEL_CITY)) {
								 * if (count.getAsignCityCount() <=
								 * count.getReportedCityCount()) { validStr +=
								 * "班级编号为"+classNum+"的班级可报市级名额已满，第"+(rowNum+1)+
								 * "行人员导入失败。\r\n"; resultStr.append(validStr);
								 * continue; } } else if
								 * (level.equals(ClassPlanApply.LEVEL_COUNTY)) {
								 * if (count.getAsignCountyCount() <=
								 * count.getReportedCountyCount()) { validStr +=
								 * "班级编号为"+classNum+"的班级可报县级名额已满，第"+(rowNum+1)+
								 * "行人员导入失败。\r\n"; resultStr.append(validStr);
								 * continue; } }
								 */
								cuQueryCommond.setSearchClassID(traClass.getClassId());
								cuQueryCommond.setSearchDepId(department.getDeptID());
								cuQueryCommond.setAuditingState(ClassUser.NO_AUDITING);
								// 单位管理员添加的学员审核状态为未审核，中组部和部委管理员添加的学员审核状态为审核通过
								batchSaveClassUser(cuQueryCommond);
								classId.add(traClass.getClassId());
								if (name.containsKey(traClass.getClassId())) {
									name.put(traClass.getClassId(), name.get(traClass.getClassId()) + cuQueryCommond.getUserName() + "、");
								} else {
									name.put(traClass.getClassId(), cuQueryCommond.getUserName() + "、");
								}
							} else
								validStr += "班级编号为" + classNum + "的班级名额已满，第" + (rowNum + 1) + "行人员导入失败。\r\n";
						} else {
							validStr += "班级编号为" + classNum + "的班级在该部门下没有配置名额，第" + (rowNum + 1) + "行人员导入失败";
							resultStr.append(validStr);
							break;
						}
					}
					resultStr.append(validStr);
				}
			}

			try {
				/**
				 * 添加提醒
				 * 
				 * @Date 2016-05-12
				 * @author RongSL
				 * @Params 提醒类型，培训班名称，承办部委名称，提醒分类
				 * */
				Department dep = (Department) request.getSession().getAttribute("currentScope");
				Role currentRole = (Role) request.getSession().getAttribute(SessionConstant.CURRENT_ROLE);
				String roleCode = currentRole.getCode();
				Iterator<String> ite = classId.iterator();
				while (ite.hasNext()) {
					TrainingClassQueryCommond commond = new TrainingClassQueryCommond();
					commond.setSearchClassId(ite.next());
					TrainingClassValidCommond tc = (TrainingClassValidCommond) trainingClassService.findList(commond).get(0);
					String n = name.get(commond.getSearchClassId()).substring(0, name.get(commond.getSearchClassId()).length() - 1);
					if (RoleConstants.ROLE_CODE_DW_ADMIN.equals(roleCode)) {// 是否是地方管理员
						remindService.remindOperate(Remind.XYBM, tc.getClassName(), dep.getDeptName(), RoleConstants.ROLE_BW_NAME, tc.getMinistrieName(), n, commond.getSearchClassId(), Remind.PXB);
					} else {
						// remindService.remindOperate(Remind.DBM,tc.getClassName(),dep.getDeptName(),apply.get(0).getDeptName(),queryCommond.getUserName(),queryCommond.getDutyRemark(),Remind.PXB);
					}
				}
			} catch (Exception e) {
				System.out.println("学员批量报名提醒接口出错了！");
			}

		} catch (IOException e) {
			e.printStackTrace();
			resultStr = new StringBuffer("failure");
			throw e;
		}
		return resultStr.toString();
	}

	/**
	 * 验证数据字典
	 * 
	 * @param dataName
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @Date 2015-8-15
	 */
	public List<BaseData> validDataNameIsExist(String dataName) throws Exception {
		BaseDataCondition baseDataCondition = new BaseDataCondition();
		baseDataCondition.setSearchBaseName(dataName);
		baseDataCondition.setRows(1);
		List<BaseData> list = baseDataManager.listBaseData(baseDataCondition);
		return list;
	}

	/*
	 * 判断这一行是否为空
	 */
	@SuppressWarnings("unused")
	private boolean judgeNullRow(List<ExcelCell> eCells, int column) {
		int sumNum = 0;
		if (eCells.size() < column) {
			column = eCells.size();
		}
		for (int i = 0; i < column; i++) {
			if (eCells.get(i).getCellValue() == null || eCells.get(i).getCellValue().toString().trim().length() == 0) {
				sumNum = sumNum + 1;
			}
		}
		if (sumNum == column) {
			return true;
		}
		return false;
	}

	/**
	 * 根据单元格数据类型返回相应数据
	 * 
	 * @param cell
	 * @return
	 */
	private Object getValue(Cell cell) {
		switch (cell.getCellType()) {
		case Cell.CELL_TYPE_STRING:
			return (cell.getRichStringCellValue().getString());
		case Cell.CELL_TYPE_NUMERIC:
			if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell)) {
				return (cell.getDateCellValue());
			} else {
				BigDecimal bg = new BigDecimal(cell.getNumericCellValue());
				return bg.toPlainString();
			}
		case Cell.CELL_TYPE_BOOLEAN:
			return (cell.getBooleanCellValue());
		case Cell.CELL_TYPE_FORMULA:
			return (cell.getCellFormula());
		default:
			return "";
		}
	}

	/**
	 * 将execl一行人员信息转换为commond
	 * 
	 * @param row
	 * @param queryCommond
	 * @return ClassUserQueryCommond
	 * @author LongJZ
	 * @throws ParseException
	 * @createDate 2016-1-18
	 */
	private ClassUserQueryCommond convertCelltoUser(Row row, ClassUserQueryCommond queryCommond) throws ParseException {
		int columnIndex = 0;
		boolean blank = true;
		for (Cell cell : row) {
			columnIndex = cell.getColumnIndex();
			switch (columnIndex) {
			case 0:// 培训班编号
				queryCommond.setSearchClassID(getValue(cell).toString());
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			case 1:// 姓名
				queryCommond.setUserName(getValue(cell).toString());
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			case 2:// 性别
				if (getValue(cell).toString().equals("男"))
					queryCommond.setSexCode("1078");
				else if (getValue(cell).toString().equals("女"))
					queryCommond.setSexCode("1079");
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			case 3:// 生日
				if (PropertyUtil.objectNotEmpty(getValue(cell))) {
					if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) {
						if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell)) {
							SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
							String birthday = !PropertyUtil.objectNotEmpty(getValue(cell)) ? null : sf.format((Date) getValue(cell));
							if (PropertyUtil.objectNotEmpty(birthday)) {
								queryCommond.setBirthday(birthday);
								queryCommond.setBirthdayYear(birthday.split("-")[0]);
								queryCommond.setBirthdayMouth(birthday.split("-")[1]);
							}
						}
					} else {
						String time = getValue(cell).toString();
						String[] strArr = time.split("-");
						if (strArr.length == 2) {
							queryCommond.setBirthdayYear(strArr[0]);
							queryCommond.setBirthdayMouth(strArr[1]);
						}
						queryCommond.setBirthday(getValue(cell).toString());
					}
					blank = false;
				} else
					queryCommond.setBirthday(null);
				break;
			case 4:// 民族
				queryCommond.setFolkCode(getValue(cell).toString());
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			case 5:// 人员级别
				queryCommond.setAdministrativeLevel(getValue(cell).toString());
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			case 6:// 单位及职务
				queryCommond.setDutyRemark(getValue(cell).toString());
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			case 7:// 手机
				queryCommond.setMobileTelephone(getValue(cell).toString());
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			case 8:// 备注
				queryCommond.setRemark(getValue(cell).toString());
				if (PropertyUtil.objectNotEmpty(getValue(cell).toString()))
					blank = false;
				break;
			}
		}
		if (blank)
			return null;
		return queryCommond;
	}

	/**
	 * 验证人员信息
	 * 
	 * @param commond
	 * @return Map<String,Object>
	 * @author LongJZ
	 * @throws Exception
	 * @createDate 2016-1-18
	 */
	public String validateUserInfo(ClassUserQueryCommond commond, String rowNum) throws Exception {
		String reason = "";

		if (!PropertyUtil.objectNotEmpty(commond.getSearchClassID()))
			reason += "第" + rowNum + "行 \"培训班编号\" 列为空，请修改后重新导入。\r\n";
		else if (commond.getSearchClassID().length() > 7)
			reason += "第" + rowNum + "行 \"培训班编号\" 列输入字符超过7位，请修改后重新导入。\r\n";
		else if (!isNumeric(commond.getSearchClassID()))
			reason += "第" + rowNum + "行 \"培训班编号\" 列输入字符无效，请修改后重新导入。\r\n";

		if (!PropertyUtil.objectNotEmpty(commond.getUserName()))
			reason += "第" + rowNum + "行 \"姓名\" 列为空，请修改后重新导入。\r\n";
		else if (commond.getUserName().length() > 20)
			reason += "第" + rowNum + "行 \"姓名\" 列长度大于20字符，请修改后重新导入。\r\n";

		if (!PropertyUtil.objectNotEmpty(commond.getSexCode()))
			reason += "第" + rowNum + "行 \"性别\" 列为空或输入不正确，请修改后重新导入。\r\n";

		if (!PropertyUtil.objectNotEmpty(commond.getBirthday()))
			reason += "第" + rowNum + "行 \"出生日期\" 列为空或输入不正确，请修改后重新导入。\r\n";

		if (PropertyUtil.objectNotEmpty(commond.getFolkCode())) {
			List<BaseData> dataList = validDataNameIsExist(commond.getFolkCode());
			if (!PropertyUtil.objectNotEmpty(dataList))
				reason += "第" + rowNum + "行 \"民族\" 列输入不正确，请修改后重新导入。\r\n";
			else {
				BaseData baseData = (BaseData) dataList.get(0);
				commond.setFolkCode(baseData.getDataCode());
			}
		} else
			reason += "第" + rowNum + "行 \"民族\" 列为空，请修改后重新导入。\r\n";

		if (PropertyUtil.objectNotEmpty(commond.getAdministrativeLevel())) {
			List<BaseData> dataList = validDataNameIsExist(commond.getAdministrativeLevel());
			if (!PropertyUtil.objectNotEmpty(dataList))
				reason += "第" + rowNum + "行 \"人员级别\" 列输入不正确，请修改后重新导入。\r\n";
			else {
				BaseData baseData = (BaseData) dataList.get(0);
				commond.setAdministrativeLevel(baseData.getDataCode());
			}
		} else
			reason += "第" + rowNum + "行 \"人员级别\" 列为空，请修改后重新导入。\r\n";

		if (!PropertyUtil.objectNotEmpty(commond.getDutyRemark()))
			reason += "第" + rowNum + "行 \"单位及职务\" 列为空，请修改后重新导入。\r\n";
		else if (commond.getDutyRemark().length() > 500)
			reason += "第" + rowNum + "行 \"单位及职务\" 列长度大于500字符，请修改后重新导入。\r\n";

		if (!PropertyUtil.objectNotEmpty(commond.getMobileTelephone()))
			/*
			 * String regExp = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
			 * Pattern p = Pattern.compile(regExp); Matcher m =
			 * p.matcher(commond.getMobileTelephone()); if (!m.find()) reason +=
			 * "第" + rowNum + "行 \"联系电话\" 列输入格式不正确，请修改后重新导入。\r\n";
			 */
			reason += "第" + rowNum + "行 \"手机\" 列为空，请修改后重新导入。\r\n";
		else if (commond.getMobileTelephone().length() > 50)
			reason += "第" + rowNum + "行 \"手机\" 列长度大于50字符，请修改后重新导入。\r\n";

		if (PropertyUtil.objectNotEmpty(commond.getRemark()) && commond.getRemark().length() > 500)
			reason += "第" + rowNum + "行 \"备注\" 列长度大于500字符，请修改后重新导入。\r\n";

		return reason;
	}

	/**
	 * 传入字符串所有字符均为数字则返回true
	 */
	public static boolean isNumeric(String str) {
		for (int i = 0; i < str.length(); i++) {
			if (!Character.isDigit(str.charAt(i)))
				return false;
		}
		return true;
	}

	/**
	 * 批量审核学员
	 * 
	 * @param validCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @createDate 2016-01-06
	 */
	@Override
	public void batchAuditingClassUser(ClassUserQueryCommond queryCommond) throws Exception {
		// 修改审核状态
		classUserDao.batchAuditingClassUser(queryCommond);
		// 审核不通过添加审核意见
		/*
		 * if(ClassUser.IS_AUDITING_N==queryCommond.getAuditingState()){ for(int
		 * i=0;i<queryCommond.getSearchClassUserIds().length;i++){ Auditing
		 * auditing=new Auditing();
		 * auditing.setAuditingState(queryCommond.getAuditingState());
		 * auditing.setAuditingOpinion(queryCommond.getAuditingOpinion());
		 * SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		 * String strDate = queryCommond.getAuditingStateDateStr(); Date
		 * date=sdf.parse(strDate); auditing.setAuditingDate(date); User
		 * user=new User(); user.setUserId(queryCommond.getAuditingUserId());
		 * auditing.setAuditingUser(user); ClassUser classUser=new ClassUser();
		 * classUser.setClassUserId(queryCommond.getSearchClassUserIds()[i]);
		 * auditing.setClassUser(classUser); auditingDao.save(auditing); } }
		 */
	}

	/**
	 * 班级人员列表(委托部委办班在线报名系统)
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author NingSS
	 * @date 2016-1-7
	 */
	@Override
	public List<QueryClassUserBean> findTrainingClassUserList(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findTrainingClassUserList(queryCommond);
	}

	/**
	 * 根据人员Id更新班级人员关系对象
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @createDate 2016-1-21
	 */
	public void updateClassUserByUserId(User user, Integer auditingState,String classId) throws Exception {
		classUserDao.updateClassUserByUserId(user, auditingState,classId);
	}

	/**
	 * 作废人员(撤销报名用)
	 * 
	 * @param userIds
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @createDate 2016-1-22
	 */
	public void toVoidUserByUserId(String[] userIds) throws Exception {
		classUserDao.toVoidUserByUserId(userIds);
	}

	/**
	 * 查询当前部门下登录号序号最小的活动人员(报名用)
	 * 
	 * @param userIds
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @createDate 2016-1-22
	 */
	public User findMinLoginIdActiveUser(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findMinLoginIdActiveUser(queryCommond);
	}

	/**
	 * 单位管理员批量撤销报名
	 * 
	 * @param userIds
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @createDate 2016-1-26
	 */
	public void deleteUserForDW(ClassUserQueryCommond queryCommond) throws Exception {
		List<String> classUserIds = new ArrayList<String>();
		List<String> userIds = new ArrayList<String>();
		for (String classUserId : queryCommond.getSearchClassUserIds()) {
			ClassUser classUser = classUserDao.find(ClassUser.class, classUserId);
			Integer auditingState = classUser.getAuditingState();
			String userId = classUser.getUser().getUserId();
			if (PropertyUtil.objectNotEmpty(auditingState) && (auditingState.equals(ClassUser.IS_AUDITING_Y.intValue())  // 报名通过
					|| auditingState.equals(ClassUser.IS_AUDITING_Y_CX_N.intValue()) // 撤销驳回
					||auditingState.equals(ClassUser.NO_AUDITING_CX))) {//撤销待审核
				queryCommond.setAuditingState(ClassUser.NO_AUDITING_CX); // 撤销待审核
				queryCommond.setSearchClassUserId(classUserId);
				classUserDao.updateAuditingStateByUserId(queryCommond);
			} else {
				classUserIds.add(classUserId);
				userIds.add(userId);
			}
		}
		if (PropertyUtil.objectNotEmpty(classUserIds))
			this.delete(classUserIds.toArray(new String[classUserIds.size()]));
		if (PropertyUtil.objectNotEmpty(userIds)) {
//			this.toVoidUserBysUserId(userIds.toArray(new String[userIds.size()]));
			userAnswerLinkDao.delUserAnswerLink(userIds.toArray(new String[userIds.size()]));
		}
	}

	/**
	 * 驳回撤销报名
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @createDate 2016-1-26
	 */
	public void rejectDeleteUser(ClassUserValidCommond commond) throws Exception {
		classUserDao.rejectDeleteUser(commond);
	}

	/**
	 * 查看驳回原因
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author LongJZ
	 * @createDate 2016-1-26
	 */
	public QueryClassUserBean findRejectReason(ClassUserValidCommond commond) throws Exception {
		return classUserDao.findRejectReason(commond);
	}

	/**
	 * 报名管理导出
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author GUOLEI
	 * @createDate 2016-1-29
	 */
	public List<QueryClassUserBean> excelSelectedUserList(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.excelSelectedUserList(queryCommond);
	}

	@Override
	public void userAppraise(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.userAppraise(queryCommond);
	}

	@Override
	public List<QueryClassUserBean> userAppraiseShow(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.userAppraiseShow(queryCommond);
	}

	@Override
	public void openLockUserAppraise(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.openLockUserAppraise(queryCommond);
	}

	/**
	 * 根据班级学员ID查询班级信息
	 * 
	 * @param commond
	 * @return
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2016-6-03
	 */
	@Override
	public List<?> findClassInfo(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findClassInfo(queryCommond);
	}

	@Override
	public List<QueryClassUserBean> userAppraiseShowOne(ClassUserCommond queryCommond) throws Exception {
		return classUserDao.userAppraiseShowOne(queryCommond);
	}

	/**
	 * 按考勤状态查询班级人员列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2016-9-18
	 */
	public List<QueryClassUserBean> findClassUserListByAttendanceState2(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findClassUserListByAttendanceState2(queryCommond);
	}

	/**
	 * 按考勤状态查询班级人员列表
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2016-9-18
	 */
	public List<QueryClassUserBean> findClassUserListYesSignUp(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findClassUserListYesSignUp(queryCommond);
	}

	/**
	 * 更新人员考勤状态
	 * 
	 * @param queryCommond
	 * @return
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2016-9-18
	 */
	@Override
	public boolean updateUserAttendanceState(ClassUserQueryCommond queryCommond) throws Exception {
		boolean flag = true;
		ClassUserQueryCommond commond = new ClassUserQueryCommond();
		BeanUtils.copyProperties(commond, queryCommond);
		for (String s : queryCommond.getSearchUserIds()) {
			commond.setSearchUserID(s);
			if (classUserDao.getUserCount(commond)) {
				classUserDao.updateUserAttendanceState(commond);
			} else {
				classUserDao.createUserAttendanceState(commond);
			}
		}
		return flag;
	}
	
	/**
	 * 批量增量人员
	 * @author RongSL
	 * @date 2017-01-09
	 * */
	@SuppressWarnings({ "deprecation", "static-access" })
	public void selectUserSave(ClassUserQueryCommond queryCommond) throws Exception{
		List <Integer> list1=new ArrayList<Integer>();
		String userIds[]=new String[queryCommond.getClassList().size()];
		HashMap<String,QueryClassUserBean> qhm=new HashMap<String, QueryClassUserBean>(); 
		Iterator<?> ite=queryCommond.getClassList().iterator();
		LinkedHashMap<?, ?> lm;
		QueryClassUserBean q;
		int i=0;
		while(ite.hasNext()){
			lm=(LinkedHashMap<?, ?>) ite.next();
			q=new QueryClassUserBean();
			q.setUserId(lm.get("userId").toString());
			q.setUserName(lm.get("userName").toString());
			q.setLoginID(lm.get("loginID").toString());
			q.setSexCode(lm.get("sexCode").toString());
			q.setRankCode(lm.get("rankCode").toString());
			q.setFolkCode(lm.get("folkCode").toString());
			q.setPosition(lm.get("position").toString());
			q.setMobileTelephone((lm.get("mobileTelephone").toString()));
			/*try{
				Date latestOperateDate=new Date(lm.get("latestOperateDate").toString());
				q.setLatestOperateDate(latestOperateDate);
			}catch(Exception e){
				q.setBirthday(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(lm.get("latestOperateDate").toString()));
			}*/
			try{
				Date d=new Date(lm.get("birthdayStr").toString());
				q.setBirthdayStr(new SimpleDateFormat("yyyy-MM").format(d));
				q.setBirthday(d);
			}catch(Exception e){
				q.setBirthdayStr(lm.get("birthdayStr").toString());
				q.setBirthday(new SimpleDateFormat("yyyy-MM").parse(lm.get("birthdayStr").toString()));
			}
			q.setRemark(!PropertyUtil.objectNotEmpty(lm.get("remark"))?"":lm.get("remark").toString());
			
			qhm.put(q.getUserId(), q);
			list1.add(Integer.valueOf(q.getUserId().toString()));
			userIds[i]=q.getUserId().toString();
			i++;
		}
		queryCommond.setSearchUserIds(userIds);
		List <Integer> list2=classUserDao.filterUser(queryCommond);
		list1.removeAll(list2);
		for(Integer o:list2){
			qhm.remove(o.toString());
		}
		for(QueryClassUserBean qc:qhm.values()){
			//判断人员在本地是否存在
			if(classUserDao.isFlagUser(qc.getUserId())){
				if(classUserDao.isFlagDepartmentUser(qc.getUserId())){
					classUserDao.isSyncDepartment(qc.getUserId());
				}else{
					String depid=classUserDao.findDepartmentDepIdByUserId(qc.getUserId());
					// 新增部门用户关联表
					DepartmentUser dUser = new DepartmentUser();
					Department department = new Department();
					department.setDeptID(depid);
					dUser.setDepartment(department);
					dUser.setActiveState(dUser.IS_ACTIVE_Y);
					User user = new User();
					user.setUserId(qc.getUserId());
					dUser.setUser(user);
					departmentUserDao.addDepartmentUser(dUser);
				}
				queryCommond.setSearchUserID(qc.getUserId());
//				ClassUserQueryCommond usa= classUserDao.findUserByUserId(queryCommond);
				Map<String, BaseData> baseDataMap=baseDataCacheUtil.getBaseData();
				User	us=new User();
				QueryClassUserBean us2=classUserDao.getUserbyUnified(qc.getUserId());
				us.setDutyRemark(qc.getPosition());
				us.setActiveState(User.IS_ACTIVE_Y);
				BaseData sex = new BaseData();
				sex.setDataCode(qc.getSexCode());
				sex.setDataName(baseDataMap.get(sex.getDataCode()).getDataName());
				BaseData folk = new BaseData();
				folk.setDataCode(qc.getFolkCode());
				folk.setDataName(baseDataMap.get(folk.getDataCode()).getDataName());
//					BaseData level = new BaseData();
//					level.setDataCode(commond.getAdministrativeLevel());
				BaseData rank = new BaseData();//职级
				rank.setDataCode(qc.getRankCode());
				rank.setDataName(baseDataMap.get(rank.getDataCode()).getDataName());
//					us.setAdministrativeLevel(level);
				us.setSexCode(sex);
				us.setFolkCode(folk);
				us.setDutyLevelCode(rank);
				us.setMobileTelephone(qc.getMobileTelephone());
				us.setBirthday(qc.getBirthday());
				us.setUserName(qc.getUserName());
				us.setActiveState(ClassUser.IS_ACTIVE_STATE_Y);
				
//				TODdlassUserDao.getUser(id.toString());
				TrainingClass tc=new TrainingClass();
				tc.setClassId(queryCommond.getSearchClassID());
				ClassUser cu=new ClassUser();
				us.setUserId(qc.getUserId());
				us.setLoginID(qc.getLoginID());
				cu.setUser(us);
				cu.setTrainingClass(tc);
				cu.setAuditingState(queryCommond.getAuditingState());
				cu.setAuditingUserId(queryCommond.getAuditingUserId());
//				if(queryCommond.getAuditingState().equals(ClassUser.IS_AUDITING_Y)){
//					cu.setAuditingDate(new Date());
//					cu.setAuditingUserIP(queryCommond.getAuditingUserIP());
//				}
				cu.setAppraiseStatus(ClassUserQueryCommond.APPRAISE_STATUS_NO);
				cu.setUserName(us.getUserName());
				cu.setSexCode(us.getSexCode());
				cu.setFolkCode(us.getFolkCode());
				cu.setBirthday(us.getBirthday());
				cu.setMobileTelephone(us.getMobileTelephone());
				cu.setDutyLevelCode(us.getDutyLevelCode());
				cu.setDutyRemark(us.getDutyRemark());
				cu.setRemark(qc.getRemark());
				cu.setCreateDate(new Date());
				cu.setLatestOperateDate(new Date());
				cu.setLastOperateTime(new Date());
//				cu.setMobileTelephone(us.getMobileTelephone());
				//更新至baseUser
				classUserDao.updateUser(qc);
				//保存至trainingClassUser
				classUserDao.save(cu);
				
//				市管不更新，不存在不更新
//				if(classUserDao.isShiguanOrJj(us.getUserId())&&!us.getDutyLevelCode().getDataCode().equals("1380")&&!us.getDutyLevelCode().getDataCode().equals("1381")){
				if(classUserDao.isShiguanOrJj(us.getUserId())){
					//更新临时用户
					classUserDao.updateTempUser(us);
					//更新正式用户
					classUserDao.updateUser(us);
				}else{
					//局级同步手机号，职务，民族
					classUserDao.updateJJUserByUnified(us);
				}
				
				//记录审计日志
//				classUserDao.auditUserLogUpdate(us2,queryCommond.getAuditingUserId(),queryCommond.getAuditingUserIP());
			}else{
				if(PropertyUtil.objectNotEmpty(queryCommond.getClickSource())){
					queryCommond.setAuditingState(queryCommond.getClickSource().equals(ClassUser.SOURCE_AUDIT_ONE)?ClassUser.IS_AUDITING_Y:ClassUser.NO_AUDITING);
				}else{
					queryCommond.setAuditingState(ClassUser.NO_AUDITING);
				}
				queryCommond.setUserName(qc.getUserName());
				queryCommond.setFolkCode(qc.getFolkCode());
				queryCommond.setSexCode(qc.getSexCode());
				queryCommond.setRank(qc.getRankCode());
				queryCommond.setBirthday(qc.getBirthdayStr());
				queryCommond.setSearchUserID(qc.getUserId());
				queryCommond.setSearchLoginID(qc.getLoginID());
				queryCommond.setDutyRemark(qc.getPosition());
				queryCommond.setRemark(qc.getRemark());
				queryCommond.setMobileTelephone(qc.getPhone());
				if(!PropertyUtil.objectNotEmpty(queryCommond.getSearchDepId())){
					String depid=classUserDao.findDepartmentDepIdByUserId(qc.getUserId());
					queryCommond.setSearchDepId(depid);
				}
				batchSaveClassUser(queryCommond);
			}
		}
		
		//将局级人员信息更新回统一用户平台数据
//		classUserDao.updateJJUserByUnified(userIds);
	}

	@Override
	public List<com.eorchis.module.trainingclass.querybean.TrainingClassQueryBean> findClassList(
			ClassUserQueryCommond queryCommond) {
		// TODO Auto-generated method stub
		return classUserDao.findClassList(queryCommond);
	}

	
	/**
	 * 批量更新学员审核状态
	 * @param queryCommond
	 * @throws Exception
	 * @author RongSL
	 * @date 2016年01月13日
	 */
	public void updateUserAuditState(ClassUserQueryCommond queryCommond) throws Exception{
		classUserDao.updateAttendanceState(queryCommond);
	}
	
	/**
	 * 导出班级人员列表
	 * @param queryCommond
	 * @return	List<QueryClassUserBean>
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2017-01-17
	 */
	@Override
	public List<QueryClassUserBean> findClassUserListYesSignUpPerfect(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findClassUserListYesSignUpPerfect(queryCommond);
	}

	@Override
	public ClassUser getUser(String classId, String userId) {
		return classUserDao.getUser(classId,userId);
	}

	/**
	 * 新增匿名评估用户	（导出评估结果使用）
	 * @Date 2017-02-06
	 * @author RongSL
	 * */
	@Override
	public void addAnonymous(QueryClassUserBean qc){
		classUserDao.addAnonymous(qc);
	}
	
	/**
	 * 更细考核学时
	 * @Date 2017-02-22
	 * @author RongSL
	 * */
	public void updateTrainingClassUserH(ClassUserQueryCommond queryCommond){
		classUserDao.updateTrainingClassUserH(queryCommond);
	}
	
	/**
	 * 更细考核备注
	 * @Date 2017-02-22
	 * @author RongSL
	 * */
	public void updateTrainingClassUserB(ClassUserQueryCommond queryCommond){
		classUserDao.updateTrainingClassUserB(queryCommond);
	}
	
	/**
	 * 更细考核结果
	 * @Date 2017-05-15
	 * @author RongSL
	 * */
	public void updateTrainingClassUserR(ClassUserQueryCommond queryCommond){
		classUserDao.updateTrainingClassUserR(queryCommond);
	}
	/**
	 * 更新考核状态
	 * @author RongSL
	 * @Date 2017-02-23
	 * */
	@Override
	public void updateExaminationState(ClassUserQueryCommond queryCommond) throws Exception {
		classUserDao.updateExaminationState(queryCommond);
		
		//当锁定考核状态时将班级与人员数据推送至培训档案系统
		if(queryCommond.getLockState().equals(TrainingClass.IS_LOCK_Y)){
			classUserDao.insertDATrainingClass(queryCommond);
			
			//锁定时更新未更改的考核状态和学时
			classUserDao.updateTrainingClassUsersH(queryCommond);
			classUserDao.updateTrainingClassUsersR(queryCommond);
		}
	}
	
	/**
	 * 判断人员是否已经存在
	 * @Date 2017-02-26
	 * @author RongSL
	 * */
	public boolean existenceClassUser(QueryClassUserBean qc){
		return classUserDao.existenceClassUser(qc);
	}
	
	/**
	 * 报名通过情况
	 * @author RongSL
	 * 2017年5月15日
	 * */
	@Override
	public String signSituation(ClassUserQueryCommond queryCommond)throws Exception{
		return classUserDao.signSituation(queryCommond);
	}
	
	/**
	 * 过滤掉不存的帐号和已报名的帐号
	 * @author RongSL
	 * 2017年9月1日
	 * */
	public Map<String,String> filterSignUpUser(ClassUserQueryCommond queryCommond)throws Exception{
		Map<String,String> maps=new HashMap<String,String>();
		ListIterator list=classUserDao.filterSignUpUser(queryCommond).listIterator();
		Object o;
		while(list.hasNext()){
			o=list.next();
			maps.put(((Object[])o)[0].toString(), ((Object[])o)[1].toString());
		}
		return maps;
	}
	
	@Override
	public List<QueryClassUserBean> findLearningExperienceList(ClassUserQueryCommond queryCommond)throws Exception{
		return classUserDao.findLearningExperienceList(queryCommond);
	}
	
	/**
	 * @author RongSL
	 * 2017年9月22日
	 * 获得附件Blob
	 * */
	@Override
	public Blob getAttachmentContent(AttachmentCommond attachmentCommond){
		return classUserDao.getAttachmentContent(attachmentCommond);
	}

	@Override
	public List<QueryClassUserBean> isFiveClass(
			ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.isFiveClass(queryCommond);
	}

	/**
	 * 查询报名人数
	 * @author RongSL
	 * 2017年10月25日
	 * */
	@Override
	public Object findListUserCount(ClassUserQueryCommond queryCommond) throws Exception{
		return classUserDao.findListUserCount(queryCommond);
	}
	
	@Override
	public ClassUserValidCommond findUserInfoById(String searchUserID) throws Exception {
		return classUserDao.findUserInfoById(searchUserID);
	}
	
	@Override
	public List<UserClassTypeHour> findZxHourList(
			ClassUserQueryCommond queryCommond,int year) throws Exception {
		List<UserClassTypeHour> zxHourList = new ArrayList<UserClassTypeHour>();
		DecimalFormat fmt = new DecimalFormat("##0.0");
		//在线学习查询年份，判断是否从当年开始
		int searchYear = Integer.parseInt(queryCommond.getSearchEndDate().substring(0,4));
		int startYear=Integer.parseInt(queryCommond.getSearchBeginDate().substring(0,4));
		Double creditHour = 0.0;
		Double zxAndGrantHour = 0.0;
		Double ntschoolHour = 0.0;
		Double nowHour = 0.0;
		if(searchYear==year){
			//积分折算学时
			creditHour = classUserDao.findCreditHour(queryCommond.getSearchUserID(), year);
			//在线学习+授予学时
			zxAndGrantHour = classUserDao.findZxAndGrantHour(queryCommond.getSearchUserID(), year);
			//网上专题班学时
			ntschoolHour = classUserDao.findNtschoolHour(queryCommond.getSearchUserID(), year);
			//当年在线学时
			nowHour = Double.valueOf(fmt.format(creditHour + zxAndGrantHour + ntschoolHour));
		}
		
		//历史年份在线学时从数据仓库获取
		List<UserClassTypeHour> hisHourList = classUserDao.findHisYearUserHour(queryCommond.getSearchUserID());
		String dutyLevelCode = queryCommond.getDutyLevelId();
		for(int i=searchYear;i>=startYear;i--){
			UserClassTypeHour zxHourBean = new UserClassTypeHour();
			//当年学时折算
			if(i == year){
				zxHourBean.setZxHour(nowHour);
				if("1380".equals(dutyLevelCode) || "1381".equals(dutyLevelCode) || "1382".equals(dutyLevelCode) || "1383".equals(dutyLevelCode)){
					if(nowHour < 44){
						zxHourBean.setZxZsHour(0.0);
					}else{
						zxHourBean.setZxZsHour(44.0);
					}
				}else{
					if(nowHour < 44){
						zxHourBean.setZxZsHour(0.0);
					}else{
						zxHourBean.setZxZsHour(44.0);
					}
				}
			}else{
				if(PropertyUtil.objectNotEmpty(hisHourList)){
					boolean isHave = true;
					for(UserClassTypeHour hourbean : hisHourList){
						if((i==Integer.valueOf(hourbean.getHourYear()).intValue())){
							zxHourBean.setZxHour(hourbean.getZxHour());
							//2012-2013年局级通过40，科级通过30（科级及以下按36折，处级及以上按44折）
							if(i < 2014){
								if("1380".equals(dutyLevelCode) || "1381".equals(dutyLevelCode) || "1382".equals(dutyLevelCode) || "1383".equals(dutyLevelCode)){
									if(hourbean.getZxHour() < 44){
										zxHourBean.setZxZsHour(0.0);
									}
//									if(hourbean.getZxHour() >= 40 && hourbean.getZxHour() <= 44){
//										zxHourBean.setZxZsHour(hourbean.getZxHour());
//									}
									if(hourbean.getZxHour() >= 44){
										zxHourBean.setZxZsHour(44.0);
									}
								}else{
									if(hourbean.getZxHour() < 44){
										zxHourBean.setZxZsHour(0.0);
									}
//									if(hourbean.getZxHour() >= 30 && hourbean.getZxHour() <= 36){
//										zxHourBean.setZxZsHour(hourbean.getZxHour());
//									}
									if(hourbean.getZxHour() > 44){
										zxHourBean.setZxZsHour(44.0);
									}
								}
							}else{//2014年以后局级通过50，科级通过80（科级及以下按36折，处级及以上按44折）
								if("1380".equals(dutyLevelCode) || "1381".equals(dutyLevelCode) || "1382".equals(dutyLevelCode) || "1383".equals(dutyLevelCode)){
									if(hourbean.getZxHour() < 44){
										zxHourBean.setZxZsHour(0.0);
									}else{
										zxHourBean.setZxZsHour(44.0);
									}
								}else{
									if(hourbean.getZxHour() < 44){
										zxHourBean.setZxZsHour(0.0);
									}else{
										zxHourBean.setZxZsHour(44.0);
									}
								}
							}
							isHave = false;
						}
					}
					if(isHave){
						zxHourBean.setZxHour(0.0);
						zxHourBean.setZxZsHour(0.0);
					}
				}else{
					zxHourBean.setZxHour(0.0);
					zxHourBean.setZxZsHour(0.0);
				}
			}
			zxHourList.add(zxHourBean);
		}
		return zxHourList;
	}

	@Override
	public Map<String, List<UserClassTypeHour>> findClassUserTotal(
			ClassUserQueryCommond queryCommond) throws Exception {
		Map<String, List<UserClassTypeHour>> map = new HashMap<String, List<UserClassTypeHour>>();
		//查询班级类型集合
		List<BaseData> list = classUserDao.findClassTypeList();
		for(BaseData baseData: list){
			//按年份获取当前类型下的学时
			List<UserClassTypeHour> userCalssTypeHourBeanList = classUserDao.findYearHourListByType(queryCommond, baseData.getDataCode());
			List<UserClassTypeHour> hourlist = new ArrayList<UserClassTypeHour>();
			int startYear = Integer.parseInt(queryCommond.getSearchBeginDate().substring(0,4));
			int endYear = Integer.parseInt(queryCommond.getSearchEndDate().substring(0,4));
			for(int i=endYear;i>=startYear;i--){
				UserClassTypeHour bean = new UserClassTypeHour();
				if(PropertyUtil.objectNotEmpty(userCalssTypeHourBeanList)){
					boolean isHave = true;
					for(UserClassTypeHour hourBean : userCalssTypeHourBeanList){
						if(i==Integer.valueOf(hourBean.getHourYear()).intValue()){
							bean.setHours(hourBean.getHours());
							isHave = false;
						}
					}
					if(isHave){
						bean.setHours(0.0);
					}
					bean.setHourYear(i+"");
				}else{
					bean.setHours(0.0);
					bean.setHourYear(i+"");
				}
				hourlist.add(bean);
			}
			map.put(baseData.getDataCode(), hourlist);
		}
		return map;
	}
	
	@Override
	public List<QueryClassUserBean> findYearHourListByYear(ClassUserQueryCommond queryCommond) throws Exception{
		return this.classUserDao.findYearHourListByYear(queryCommond);
	}
	
	/**
	 * 我的参训情况
	 * @author RongSL
	 * 2017年12月5日
	 * */
	@Override
	public List<QueryClassUserBean> myClassTrainingList(ClassUserQueryCommond queryCommond) throws Exception{
		return classUserDao.myClassTrainingList(queryCommond);
	}
	
	/**
	 * 学员统计（管理员用）
	 * @author RongSL
	 * 2017年12月19日
	 * */
	public List<QueryClassUserBean> findUserStatisticsByAdmin(ClassUserQueryCommond queryCommond) throws Exception {
		return classUserDao.findUserStatisticsByAdmin(queryCommond);
	}
	
	/**
	 * 查询学员统计数据列表
	 * @author RongSL
	 * 2017年12月20日
	 * */
	public List<QueryClassUserBean> findUserClassTypeHourList(ClassUserQueryCommond queryCommond) throws Exception{
		return classUserDao.findUserClassTypeHourList(queryCommond);
	}
	
	/**
	 * 查询未报名人员(归档数据)
	 * @param queryCommond
	 * @return List<QueryClassUserBean>
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2016-12-23
	 */
	public List<QueryClassUserBean> findNoClassUserListByPxarchives(ClassUserQueryCommond queryCommond) throws Exception{
		return classUserDao.findNoClassUserListByPxarchives(queryCommond);
	}
	/**
	 * 查询报名人员(归档数据)
	 * @param queryCommond
	 * @return List<QueryClassUserBean>
	 * @throws Exception
	 * @author RongSL
	 * @createDate 2016-12-23
	 */
	public List<QueryClassUserBean> findClassUserListByPxarchives(ClassUserQueryCommond queryCommond) throws Exception{
		return classUserDao.findClassUserListByPxarchives(queryCommond);
	}
	
	@Override
	public List<QueryClassUserBean> findStatisticsUserByClass(ClassUserQueryCommond queryCommond) throws Exception{
		int limit=queryCommond.getLimit();
		int page=queryCommond.getPage();
		if(PropertyUtil.objectNotEmpty(queryCommond.getIsTrainingClass())&&queryCommond.getIsTrainingClass().intValue()==2){
			queryCommond.setLimit(-1);
		}
		List<QueryClassUserBean> list=classUserDao.findStatisticsUserByClass(queryCommond);
		//当查询不在培训班中的学员时
		if(PropertyUtil.objectNotEmpty(queryCommond.getIsTrainingClass())&&queryCommond.getIsTrainingClass().intValue()==2){
			String []userIds=new String[list.size()];
			for(int i=0;i<list.size();i++){
				userIds[i]=list.get(i).getUserId();
			}
			ClassUserQueryCommond commond=new ClassUserQueryCommond();
			commond.setSearchNoUserIds(userIds);
			commond.setSearchDepId(queryCommond.getSearchDepId());
			commond.setLimit(limit);
			commond.setPage(page);
			list=classUserDao.findStatisticsUserByClass(commond);
			//当查询不在培训班中的学员数据时，班级数量需为0
			for(QueryClassUserBean qcu:list){
				qcu.setClassCount(new BigInteger("0"));
			}
			BeanUtils.copyProperties(commond, queryCommond);
		}
		return list;
	}
	
	/**
	 * 保存撤销报名的用户id
	 * @param annulUser
	 * @throws Exception
	 */
	public void saveAnnulUser(String[] userIds) throws Exception{
		for (int i = 0; i < userIds.length; i++) {
			System.out.println("==============userId:" + userIds[i]);
			classUserDao.saveAnnulUser(userIds[i]);
		}
	}
	
	
	
}
